{layout name="/base"}
    <div class="row">
      <div class="col-lg-12">
        <h1>会员管理 <small>会员信息列表</small></h1>
        <ol class="breadcrumb">
          <li><a href="/index"><i class="fa fa-dashboard"></i> 管理首页</a></li>
          <li class="active"><i class="fa fa-table"></i> 会员信息列表</li>
        </ol>
        <div class="alert alert-success alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
          这里可以添加、修改、删除会员信息
        </div>
      </div>
    </div>
    <!-- /.row -->
    <div class="row">
      <div class="col-lg-12">
        <form class="form-horizontal" role="form" action="/users" method="get">
          
          <div class="form-group col-lg-2" style="margin-right:10px;">
            <label for="">状态</label>
            <select class="form-control" name="status">
              <option value="">全部</option>
              <option value="0">未绑定</option>
              <option value="1">已绑定</option>
            </select>
          </div>
          <div class="form-group col-lg-2" style="margin-right:10px;">
            <label for="">请选择分公司</label>
            <select class="form-control" id="branch" name="branch">
              <option>全部</option>
              {foreach $branchs as $k => $v}
              {if($k == input('get.branch'))}
              <option selected value="{$k}">{$v}</option>
              {else/}
              <option  value="{$k}">{$v}</option>
              {/if}
              {/foreach}
            </select>
          </div>
          <div class="form-group col-lg-4" style="margin-right:10px;">
            <label for="">请选择营地</label>
            <select id="camps_id" class="form-control" name="camp_id">
              <option value="">全部</option>
            </select>
          </div>
          <div class="form-group col-lg-4 input-group">  
            <label for="">请输入会员账号关键字</label>
            <input type="hidden" name="searchfield" value="mobile">
            {if (input('get.keyword'))}
            <input class="form-control" type="text"  value="{:input('get.keyword')}" name="keyword">
            {else /}
            <input class="form-control" type="text"  placeholder="请输入会员信息" name="keyword">
            {/if}
            <label for="">&nbsp;</label>
            <span class="input-group-btn">
              <button class="btn btn-default" type="submit">搜索</button>
            </span>
          </div>
          <div class="clearfix"></div>
        </form>
        <div class="table-responsive">
          <table class="table table-bordered table-hover table-striped tablesorter">
            <thead>
              <tr>
                <th><div class="checker"><span><input type="checkbox" name=""></span></div></th>
                <th>会员账号</th>
                <th>会员姓名</th>
                <th>会员手机号码</th>
                <th>会员邮箱</th>
                <th>会员旅行币余额</th>
                <th>会员现金余额</th>
                <th>会员所属营地</th>
                <th>泊位编号</th>
                <th>会员注册时间</th>
                <th>会员状态</th>
                <th>实名认证</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
            <form id="member" class="form-horizontal" role="form" action="/member/delete" method="post">
            <input type="hidden" id='method' name="_method" value="DELETE">
            <input type="hidden" name="status" value='0' />
            {volist name='list' id='vo'}
              <tr>
                <td><div class="checker"><span><input type="checkbox" name="ids[]" value="{$vo.id}"></span></div></td>
                <td>{$vo.mobile}</td>
                <td>{$vo.real_name}</td>
                <td>{$vo.mobile}</td>
                <th>{$vo.email}</th>
                <th>{$vo->integral($vo.id)}</th>
                <th>{$vo->blance($vo.id)}</th>
                <th>{$vo.camps.name}</th>
                <th>{$vo.caravans.park_num}</th>
                <td>{$vo.created_at}</td>
                <td>{$vo.status}</td>
                <td>{$vo->getAuthentication($vo['authentication'])}</td>
                <td>
                <a href="/users/{$vo.id}">查看</a>
                </td>
              </tr>
          {/volist}
        </form>
      </tbody>
    </table>
    </div>

<script type="text/javascript">
    function init(c) {	
      $.post("/ajax/campslist",
        {
          branch_id:$("#branch").children('option:selected').val()
        },
        function(data,status){
          var optionstring = "";   
          $.each(data,function(id,name){    
             //输出
             if (id == c) {
              optionstring += "<option selected value=\"" + id + "\" >" + name + "</option>"; 
             }else{
              optionstring += "<option value=\"" + id + "\" >" + name + "</option>"; 
             }
          })
          $("#camps_id").html("<option value=''>请选择...</option> "+optionstring);
        });
    };
    init({:input('get.camp_id')});
    $("#branch").change(function(){
      init();
      });
</script>
